<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>

<html>
<head>
    <title>Simple Done System</title>
    <sj:head jqueryui="true" jquerytheme="cupertino"/>
    <script src="/js/jquery.ui.autocomplete.ext.js"></script>
    <script src="/js/jquery.ui.autocomplete.js"></script>
    <script src="http://dev.jquery.com/view/trunk/plugins/dimensions/jquery.dimensions.js"></script>    
    <s:url id="urlTypes" action="types"/>
    <script>
      $(function() {
        $("input#taskType").autocomplete({
          ajax: '<s:property value="urlTypes"/>'
        })
      });
    </script>
    <link rel="stylesheet" href="/js/jquery.ui.autocomplete.css" type="text/css"/>
</head>

<body>
<s:form action="update" method="post">
    <s:hidden name="key"/>
    <s:textfield name="name" label="Task name"/>
    <s:textfield id="taskType" name="taskType" label="Type"/>
    <s:textarea name="description" label="Description" cols="20" rows="6"/>
    <sj:datepicker value="today" id="created" name="created" displayFormat="yy-mm-dd" label="Created" showButtonPanel="true"/>
    <sj:datepicker id="expectedEnd" name="expectedEnd" displayFormat="yy-mm-dd" label="Expected end"/>
    <sj:datepicker id="finished" name="finished" displayFormat="yy-mm-dd" label="Finished"/>
    <s:submit/>
</s:form>

<ul>
    <s:iterator value="tasks" var="task">
        <li><s:property value="name"/> (<s:property value="created"/> - <s:property value="exepctedEnd"/>): <s:property
                value="description"/></li>
    </s:iterator>
</ul>

</body>
</html>
